/**
* @file infrared.h
* @brief Header file for the infrared module
*
* This file contains the function declarations and macro definitions for the infrared module,
* used for device discovery and connection management.
* @作者 Maker Studio
* @license Apache 2.0
* This code is open-sourced under the Apache 2.0 license. When using open-source libraries
* or code, please ensure to acknowledge the original authors and sources.
**/

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#include <string.h>
#include "ohos_init.h"
#include "cmsis_os2.h"

#include "iot_uart.h"
#include "pinctrl.h"
#include "uart.h"

#define UART2 2
#define UART_TRANSFER_SIZE 800 
#define UART_TRANSFER_BUFF_SIZE 16 

#define UART_BAUDRATE 115200
#define UART_DATA_BITS 3
#define UART_STOP_BITS 1
#define UART_PARITY_BIT 0

#define CONFIG_UART_BUS_ID 2
#define CONFIG_UART_TXD_PIN 8
#define CONFIG_UART_RXD_PIN 7
#define CONFIG_UART_PIN_MODE 2

uint8_t getSum(uint8_t *data, uint8_t len);
uint8_t IrStudy(uint8_t *data, uint8_t group);
uint8_t IrSend(uint8_t *data, uint8_t group);
void infrared_init(void);
void uart2_config(void);
void print_buffer_hex(const unsigned char *buffer, size_t length);
